import React, {Component} from 'react';
import {inject, observer} from 'mobx-react';
import {toJS} from 'mobx';
import cssModules from 'react-css-modules';
import classnames from 'classnames';
import {Form, Row, Button, Radio} from 'antd';
import {FormInput, FormItemCustom} from '../../component/FormItem';
import {addUnitInfo} from 'util/api';
import styles from './style.less';

@inject('CardUsedLossStore')
@observer
@cssModules(styles)
class AddUnitContent extends Component {
  constructor(props) {
    super(props);
    this.store = this.props.CardUsedLossStore;
  }

  render() {
    const {fields, handleFormChange} = this.store;

    let scale = Math.ceil((140 / 600) * 24);
    const formItemLayout = {
      labelCol: {
        sm: {span: scale},
      },
      wrapperCol: {
        sm: {span: 24 - scale},
      },
    };

    return (
      <Form
        {...formItemLayout}
        className={styles['add-users-wrap']}
        autoComplete="off">
        <FormInput
          {...fields}
          onChange={handleFormChange}
          label={'卡号'}
          disabled={true}
          name={'cardNumber'}
          rules={[
            {
              required: true,
              message: '必须填写内容!',
            },
          ]}
        />
        <FormInput
          {...fields}
          onChange={handleFormChange}
          label={'所属户室'}
          disabled={true}
          name={'blockAndUnit'}
          rules={[
            {
              required: false,
              message: '必须填写内容!',
            },
          ]}
        />
        <FormInput
          {...fields}
          onChange={handleFormChange}
          label={'使用者'}
          disabled={true}
          name={'cname'}
          rules={[
            {
              required: false,
              message: '必须填写内容!',
            },
          ]}
        />
        <FormInput
          {...fields}
          onChange={handleFormChange}
          label={'挂失原因'}
          disabled={false}
          name={'reason'}
          rules={[
            {
              required: false,
              message: '必须填写内容!',
            },
          ]}
        />
      </Form>
    );
  }
}

export default AddUnitContent;
